<?php

class Employee extends Eloquent {
	protected $table;
	public $timestamps = false;
	
	
	/********************************************************************************
	 ******************************** PUBLIC FUNCTIONS ******************************
	 ********************************************************************************/
	
	/**
	 * ses the table for the model
	 */
	public function __construct() {
		$this->table = Helper::getDB ('core') . 'employee';
		parent::__construct();
	}
	
	
	/**********************************************************************
	 ************************** HAS MANY RELATIONS ************************
	 **********************************************************************/
	
	/**
	 * returns the assigned roles for this employee
	 * @return		array
	 */
	public function roles(){
		return $this->belongsTo('Role', (Helper::getDB('core') . 'role'), 'employee_id', 'role_id');
	}
	
	
	/**********************************************************************
	 ************************* BELONGS TO RELATIONS ***********************
	 **********************************************************************/
	
	/**
	 * returns the person for current employee
	 * @return		mixed
	 */
	public function person(){
		return $this->belongsTo('Person', 'id');
	}

}